//
//  GUIButton.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/3/28.
//  Copyright © 2018年 薛小刚. All rights reserved.
//

#import "GUIButton.h"

@implementation GUIButton

-(id)initWithFrame:(CGRect)frame
{
    if(self = [super initWithFrame:frame])
    {
        [self addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        
    }
    return self;
}
-(void)btnClick:(GUIButton *)button
{
    if(self.action)
    {
        self.action(button);
    }
}

-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    
    if ([self pointInside:point withEvent:event]) {
        self.userInteractionEnabled = YES;
    } else {
        self.userInteractionEnabled = NO;
    }
    
    return [super hitTest:point withEvent:event];
}


@end
